﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BloomsburyBanHang.DAO;
namespace BloomsburyBanHang
{
    public partial class Site1 : System.Web.UI.MasterPage
    {
        public string spCart = "";
        public int numItem = 0;
        public double totalPrice = 0.0;
        protected void Page_Load(object sender, EventArgs e)
        {
           // Session["total"] = total.Text;
            string shoppingcart = Session["shoppingcart"] as string;
            if (shoppingcart != null)
            {
                string[] shoppingCartItem = shoppingcart.Split(',');
                for (int i = 1; i < shoppingCartItem.Count(); i++)
                {
                    SAN_PHAM sp = new SAN_PHAM();
                    sp = SanPhamDAO.TimSanPhamTheoMa(Convert.ToInt32(shoppingCartItem[i]));
                    spCart += "<dt id='cart_block_product' >"
                    + "<a class='cart_block_product_name' href='#' title='Collant - Aqua blue'>" + sp.TenSanPham + "</a>"
                    + "<span class='taille_cho7'>" + sp.MaSanPham + "</span>"
                    + "<span class='quantity-formated'>"
                    + "<span class='quantity'>1</span>"
                    + "</span>"
                    + "<span class='price'>" + sp.Gia + "</span>"
                    + "<span class='remove_link'><a href='#'>X</a></span>"
                    + "<span class='spacer_panier'></span>"
                    + "</dt>";
                    totalPrice += (double)sp.Gia;
                }
                numItem = shoppingCartItem.Count() - 1;
             

            }
        }
    }
}